$(function() {
	// 购买商品信息  下拉
	$(".xiala").css("display", "none")
	$(".name").click(function() {
		$(".xiala").slideToggle()
	})
	
	
	var storage = ""
	storage = window.localStorage
	var shops = JSON.parse(storage.getItem("shops"))
	// var shop = JSON.parse(storage.getItem("shop"))
	// console.log(shops)
	var shopname = shops[shops.length-1].shopname
	console.log(shopname)
	$(".sn").html(shopname);
	// console.log(storage.getItem("shopname"))
	var b = shops[shops.length-1].money;
	$(".pay-money").html(b + 3);
	var spl = shops[shops.length-1].shoplis
	$.each(spl,function(i,e){
		if (spl[i] != null) {
			$("<div class='food'></div>").html(`
				<span>`+spl[i].name+`×` + spl[i].num + `</span>
				<span class="money">￥` + spl[i].money + `</span>
			`).appendTo(".xiala")
		}
	})
	$("<div class='food'></div>").html(`
				<span>配送费</span>
				<span class="money">￥3</span>
		`).appendTo(".xiala")
		
	// 选择支付方式
	$(".gou").eq(0).css("display", "block")
	$(".gou").eq(1).css("display", "none")
	$(".zf").click(function() {
		$(".gou").css("display", "none")
		$(this).children().next().fadeToggle()
	})
	
	
	
	$(".pay-btn").click(function(){
		var choose;
		if (confirm("是否确认支付")) {
			storage.setItem("choose","yes")
		} else {
			storage.setItem("choose","no")
		}
		
		window.location.href = "order.html"
	})
})